#!/usr/bin/env bash

echo '=====开始从阿里云拉取didiok-ranking镜像====='
echo '===== 阿里云 仓库认证====='
docker login --username=2505757460@qq.com --password=didiok520 registry.cn-hangzhou.aliyuncs.com

echo '=====开始拉取 didiok_admin====='
docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-admin

#echo '=====开始拉取 didiok-community====='
#docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-community

#echo '=====开始拉取 didiok-file====='
#docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-file

echo '=====开始拉取 didiok-gateway====='
docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-gateway

#echo '=====开始拉取 didiok-rank====='
#docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-rank

echo '=====开始拉取 didiok-search====='
docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-search

echo '=====开始拉取 didiok-sms====='
docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-sms

echo '=====开始拉取 didiok-user====='
docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-user

echo '=====开始拉取 didiok-wechat====='
docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-wechat

#echo '=====开始拉取 didiok_pay====='
#docker pull registry.cn-hangzhou.aliyuncs.com/didiok/didiok-pay


echo '=====删除docker标签为none的镜像====='
if [[ -n $(docker images | grep none | awk '{print $3}') ]];then
    echo "------ 存在虚悬镜像，开始删除... ------"
    docker rmi $(docker images | grep none | awk '{print $3}')
else
    echo "------ 不存在虚悬镜像 ------"
fi

echo '拉取完成 请使用 docker images 查看是否拉取成功'
